package org.example;

//代理对象,静态代理
public class TeacherProxy implements ITeacher {
	
	private ITeacher target; // 目标对象，通过接口来聚合

	//构造器
	public TeacherProxy(ITeacher target) {
		this.target = target;
	}

	@Override
	public void teach() {
		before();
		target.teach();
		after();
	}

	public void before() {
		System.out.println("代理before方法执行了,完成某些操作");
	}

	public void after() {
		System.out.println("代理after方法执行了,完成某些操作");
	}

}
